package com.weaver.openapi.service;

import com.weaver.openapi.pojo.eb.params.form.*;
import com.weaver.openapi.util.*;
import java.util.*;
import cn.hutool.http.*;
import com.alibaba.fastjson.*;
import com.weaver.openapi.pojo.eb.res.form.*;

public class EbFormService
{
    public static EbFormResultVo getAllDataCount(final EbFormVo ebFormVo, String host, final Map<String, String> headers) {
        host = HostUtil.beforeRequestCheckHeaders(host, headers, "application/json");
        final Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("access_token", ebFormVo.getAccessToken());
        paramMap.put("userid", ebFormVo.getUserid());
        paramMap.put("objId", ebFormVo.getObjId());
        final String resJson = ((HttpRequest)HttpRequest.post(host + "/api/ebuilder/form/dataset/v1/getAllDataCount").body(JSONObject.toJSONString((Object)paramMap)).headerMap((Map)headers, true)).execute().body();
        return (EbFormResultVo)JSONObject.parseObject(resJson, (Class)EbFormResultVo.class);
    }
    
    public static EbFormFieldResultVo getFields(final EbFormVo ebFormVo, String host, final Map<String, String> headers) {
        host = HostUtil.beforeRequestCheckHeaders(host, headers, "application/json");
        final Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("access_token", ebFormVo.getAccessToken());
        paramMap.put("userid", ebFormVo.getUserid());
        paramMap.put("objId", ebFormVo.getObjId());
        paramMap.put("isReturnDetail", ebFormVo.getIsReturnDetail());
        final String resJson = ((HttpRequest)HttpRequest.post(host + "/api/ebuilder/form/dataset/v1/getFields").body(JSONObject.toJSONString((Object)paramMap)).headerMap((Map)headers, true)).execute().body();
        return (EbFormFieldResultVo)JSONObject.parseObject(resJson, (Class)EbFormFieldResultVo.class);
    }
    
    public static EbFormAuthDetailResultVo getDetail(final EbFormVo ebFormVo, String host, final Map<String, String> headers) {
        host = HostUtil.beforeRequestCheckHeaders(host, headers, "application/json");
        final Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("access_token", ebFormVo.getAccessToken());
        paramMap.put("userid", ebFormVo.getUserid());
        paramMap.put("objId", ebFormVo.getObjId());
        paramMap.put("dataId", ebFormVo.getDataId());
        final String resJson = ((HttpRequest)HttpRequest.post(host + "/api/ebuilder/form/dataset/v1/getDetail").body(JSONObject.toJSONString((Object)paramMap)).headerMap((Map)headers, true)).execute().body();
        return (EbFormAuthDetailResultVo)JSONObject.parseObject(resJson, (Class)EbFormAuthDetailResultVo.class);
    }
}
